AC_DEFUN([AX_C_STATIC], [
  AC_CACHE_CHECK([whether the compiler supports the static keyword], [ax_cv_static],
    [AC_COMPILE_IFELSE(
      [AC_LANG_SOURCE([static int foo(void);static int foo(void){static int a=0;return a++;}int main(){return foo();}])],
      [ax_cv_static=yes], [ax_cv_static=no]
    )
  ])
  if test "x${ax_cv_static}" = "xyes"; then
    AC_DEFINE([HAVE_STATIC], [1], [define if your compiler supports the static keyword])
  fi
])

